import http from ".";

/**
 * 试题类型列表
 */
const fetchTypeList = () => http.get("/questions/types");

/**
 * 添加试题类型
 * @param name
 */
const addTypeItem = (name: string) => http.post("/questions/types", { name });

/**
 * 添加试题
 * @param title
 * @param content
 * @param e_tid
 * @param sid
 * @param q_tid
 * @param answer
 */
const addItem = (
    title: string,
    content: string,
    e_tid: string,
    sid: string,
    q_tid: string,
    answer: string
) => http.post("/questions", { title, content, e_tid, sid, q_tid, answer });

/**
 * 试题列表
 * @param pagenum
 * @param pagesize
 * @param sids
 * @param etid
 * @param qtid
 */
const fetchList = (
    pagenum: number,
    pagesize: number,
    sids: string,
    etid: string,
    qtid: string
) => http.get("/questions", { pagenum, pagesize, sids, etid, qtid });

export { fetchTypeList, addItem, addTypeItem, fetchList };
